package com.qfedu.mapper;

import com.qfedu.model.Contractor;
import com.qfedu.model.Developer;
import com.qfedu.model.Taskplan;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @author LiJH
 * @date 2023-02-10
 */
public interface TaskplanMapper {
    @Select("select count(*) from taskplan where status=1")
    long count();
    @Select("select * from taskplan where status=1 limit #{currentPage},#{pageSize}")
    List<Taskplan> findPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);

    @Insert("insert into taskplan(tid,tname,starttime,endtime,bid,updatetime)" +
            " values(#{tid},#{tname},#{starttime},#{endtime},#{bid},#{updatetime}) ")
    int addTaskplan(Taskplan taskplan);

    @Select("select * from taskplan where tid=#{tid} and status=1 ")
    Taskplan findById(String tid);
    @Select("select * from taskplan where bid=#{bid} and status=1 ")
    List<Taskplan> findByBid(String bid);

    @Update("update taskplan set tname=#{tname},starttime=#{starttime},endtime=#{endtime}" +
            "bid=#{bid}, updatetime=#{updatetime} where tid=#{tid}")
    int editTaskplan(Taskplan taskplan);

    //删除
    @Update("update taskplan set status=0 where tid = #{tid}")
    int deleteByTid(String tid);
}
